package autoteam;

import java.util.HashMap;
import java.util.Map;

import db.DBRecord;

public class Player
{
	private String firstname;
	private String lastname;
	private Sports sport;
	private String phone;
	private String email;
	private String comment;
	private double height;
	private double weight;
	private int numYearsExperience;
	private int skill;
	private int teamId;
	private String pathToPicture;
	private String bio;
	private boolean[] availNights;
	
	public Player(String firstname, String lastname)
	{
		this.firstname = firstname;
		this.lastname = lastname;
	}
	
	
	
	public String getFirstname()
	{
		return firstname;
	}



	public void setFirstname(String firstname)
	{
		this.firstname = firstname;
	}



	public String getLastname()
	{
		return lastname;
	}



	public void setLastname(String lastname)
	{
		this.lastname = lastname;
	}



	public Sports getSport()
	{
		return sport;
	}



	public void setSport(Sports sport)
	{
		this.sport = sport;
	}



	public String getPhone()
	{
		return phone;
	}



	public void setPhone(String phone)
	{
		this.phone = phone;
	}



	public String getEmail()
	{
		return email;
	}



	public void setEmail(String email)
	{
		this.email = email;
	}



	public String getComment()
	{
		return comment;
	}



	public void setComment(String comment)
	{
		this.comment = comment;
	}



	public double getHeight()
	{
		return height;
	}



	public void setHeight(double height)
	{
		this.height = height;
	}



	public double getWeight()
	{
		return weight;
	}



	public void setWeight(double weight)
	{
		this.weight = weight;
	}



	public int getNumYearsExperience()
	{
		return numYearsExperience;
	}



	public void setNumYearsExperience(int numYearsExperience)
	{
		this.numYearsExperience = numYearsExperience;
	}



	public int getSkill()
	{
		return skill;
	}



	public void setSkill(int skill)
	{
		this.skill = skill;
	}



	public int getTeamId()
	{
		return teamId;
	}



	public void setTeamId(int teamId)
	{
		this.teamId = teamId;
	}



	public String getPathToPicture()
	{
		return pathToPicture;
	}



	public void setPathToPicture(String pathToPicture)
	{
		this.pathToPicture = pathToPicture;
	}



	public String getBio()
	{
		return bio;
	}



	public void setBio(String bio)
	{
		this.bio = bio;
	}



	public DBRecord createRecord()
	{
		DBRecord rec = new DBRecord();
		rec.addField("firstname", firstname);
		rec.addField("lastname", lastname);
		rec.addField("bio", bio);
		rec.addField("comment", comment);
		rec.addField("email", email);
		rec.addField("height", height);
		rec.addField("weight", weight);
		rec.addField("numYearsExperience", numYearsExperience);
		rec.addField("pathToPicture", pathToPicture);
		rec.addField("skill", skill);
		rec.addField("sport", sport.toString());
		rec.addField("teamId", teamId);
		String nights = "";
		Map<Integer,String> m = new HashMap<Integer, String>();
		m.put(0, "m");
		m.put(1, "t");
		m.put(2, "w");
		m.put(3, "r");
		m.put(4, "f");
		for(int i = 0; i < availNights.length; i++)
		{
			if (availNights[i])
				nights += m.get(i);
		}
		rec.addField("availNights",nights);
		return rec;
	}
	
}
